import _json
import os
from config.setting import file_path

def save_data(user_data):
    name=user_data['user_name'] #把用户名取出来
    with open(fr'{file_path}\{name}.json','w',encoding='utf-8') as f:
        _json.dump(user_data,f)
    #return Ture,f'{user_name}注册成功'
def get_data(user_name):
    user=fr'{file_path}\{user_name}.json'
    if os.path.exists(user):
        with open(user,'r',enconding='utf-8') as f:
            user_data=_json.load(f)
            return user_data